function [BestIters, BestIndex] = getBestModelIters(results)
ImgSetList = fieldnames(results);
K = size(results.(ImgSetList{1}), 1);
BestIters = cell(K, 1);
BestIndex = cell(K, 1);

for k = 1 : K
    best_iters = cell(1, length(ImgSetList));
    best_index = best_iters;
    for i = 1 : length(ImgSetList)
        ImgSet = ImgSetList{i};
        if srdata.isBigDataSet(ImgSet) || size(results.(ImgSet), 1) < k || isempty(results.(ImgSet){k, 3})
            continue
        end
        iter1 = get_iter(results.(ImgSet){k, 3}.PSNR);
        iter2 = get_iter(results.(ImgSet){k, 3}.SSIM);
        best_iters{i} = [iter1, iter2];
        
        Index = results.(ImgSet){k, 4};
        best_index{i} = [find(Index == iter1), find(Index == iter2)];
    end
    BestIters{k} = unique([best_iters{:}]);
    BestIndex{k} = unique([best_index{:}]);
end

function iter = get_iter(caffemodelfile)
%%
% caffemodelfile = 'myVDSR_fr_msra_x2_iter_105000.caffemodel';
[~, caffemodelfile] = fileparts(caffemodelfile);
pre = 'iter_';
k = strfind(caffemodelfile, pre) + length(pre);
iter = eval(caffemodelfile(k : end));
